5c1b32
@@ -27,6 +27,7 @@
import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
 import javax.ws.rs.QueryParam;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.hadoop.hbase.CellUtil;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.yetus.audience.InterfaceAudience;
 import org.slf4j.Logger;
@@ -123,7 +124,7 @@
public class TableResource extends ResourceBase {
       @QueryParam(Constants.SCAN_LIMIT) int userRequestedLimit,
       @DefaultValue("") @QueryParam(Constants.SCAN_START_ROW) String startRow,
       @DefaultValue("") @QueryParam(Constants.SCAN_END_ROW) String endRow,
-      @DefaultValue("") @QueryParam(Constants.SCAN_COLUMN) List<String> column,
+      @QueryParam(Constants.SCAN_COLUMN) List<String> column,
       @DefaultValue("1") @QueryParam(Constants.SCAN_MAX_VERSIONS) int maxVersions,
       @DefaultValue("-1") @QueryParam(Constants.SCAN_BATCH_SIZE) int batchSize,
       @DefaultValue("0") @QueryParam(Constants.SCAN_START_TIME) long startTime,
@@ -156,26 +157,21 @@
public class TableResource extends ResourceBase {
         tableScan.setStartRow(Bytes.toBytes(startRow));
       }
       tableScan.setStopRow(Bytes.toBytes(endRow));
-      for (String csplit : column) {
-        String[] familysplit = csplit.trim().split(":");
-        if (familysplit.length == 2) {
-          if (familysplit[1].length() > 0) {
-            if (LOG.isTraceEnabled()) {
-              LOG.trace("Scan family and column : " + familysplit[0] + "  " + familysplit[1]);
-            }
-            tableScan.addColumn(Bytes.toBytes(familysplit[0]), Bytes.toBytes(familysplit[1]));
-          } else {
-            tableScan.addFamily(Bytes.toBytes(familysplit[0]));
-            if (LOG.isTraceEnabled()) {
-              LOG.trace("Scan family : " + familysplit[0] + " and empty qualifier.");
-            }
-            tableScan.addColumn(Bytes.toBytes(familysplit[0]), null);
+      for (String col : column) {
+        byte [][] parts = CellUtil.parseColumn(Bytes.toBytes(col.trim()));
+        if (parts.length == 1) {
+          if (LOG.isTraceEnabled()) {
+            LOG.trace("Scan family : " + Bytes.toStringBinary(parts[0]));
           }
-        } else if (StringUtils.isNotEmpty(familysplit[0])) {
+          tableScan.addFamily(parts[0]);
+        } else if (parts.length == 2) {
           if (LOG.isTraceEnabled()) {
-            LOG.trace("Scan family : " + familysplit[0]);
+            LOG.trace("Scan family and column : " + Bytes.toStringBinary(parts[0])
+                + "  " + Bytes.toStringBinary(parts[1]));
           }
-          tableScan.addFamily(Bytes.toBytes(familysplit[0]));
+          tableScan.addColumn(parts[0], parts[1]);
+        } else {
+          throw new IllegalArgumentException("Invalid column specifier.");
         }
       }
       FilterList filterList = new FilterList();
